package com.example.demo.service;

import com.example.demo.bean.staff;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service //将类交由spring管理
public class staffService {

    @Autowired
    private com.example.demo.Dao.staffdao staffdao;

    /**
     * 添加信息
     * @paramstaffid,staffname,staffgender,staffprofession,staffyear,staffphoto
     * @returnint staffid,String staffname,String staffgender,String staffprofession,int staffyear,String staffphoto
     */
    public int Insertstaff(staff staff){
        staffdao.insert(staff);
        return 1;
    }

    /**
     * 通过商品编号删除数据
     * @param
     * @return
     */
    public int Deletestaff(Integer name){
        staffdao.deleteById(name);
        return 1;}

    /**
     * 修改信息
     * @paramstaffid,staffname,staffgender,staffprofession,staffyear,staffphoto
     * @returnint staffid,String staffname,String staffgender,String staffprofession,int staffyear,String staffphoto
     */
    public int Updatestaff(staff staff) {
        staffdao.updateById(staff);
        return 1;
    }

    /**
     * 显示所有数据
     * @return
     */
    public List<staff> ShowAllstaff() {
        return staffdao.ShowAllstaff();
    }

    /**
     * 通过名称查询数据
     * @param number
     * @return
     */
//    public staff Showstaff(Integer staffid){
//        return staffdao.Showstaff(staffid);
//    }

    /**
     * 查询商品总数
     * @return
     */
    public int Totalstaff(){
        staffdao.Totalstaff();
        return 1;
    };
}
